package com.rs.util;

import com.rs.entity.enums.CommandType;
import com.rs.entity.task.Command;
import com.rs.entity.task.CommandAction;
import lombok.extern.slf4j.Slf4j;

/**
 * 日志工具
 *
 * @author zhouwz
 * @date 2020/9/14 14:47
 */
@Slf4j
public class LogUtil {
    public static void logFormat(Command command) {
        log.info("━━━━━━━━━━━━━━━━━━━━━━↓ 接收命令-开始[{}]-紧急状态:{}-命令号:{}-命令类型[{}] ↓━━━━━━━━━━━━━━━━━━━━━", command.getDeviceNo(), command.getEmergencyType(), command.getCommandNo(), CommandType.getCommandType(command.getCommandType()).getMsg());
        if (command.getCommandList() != null) {
            for (CommandAction commandAction : command.getCommandList()) {
                log.info("┃{}_●{}{}", command.getDeviceNo(), commandAction.getNodeCode(), commandAction.toString());
            }
            log.info("━━━━━━━━━━━━━━━━━━━━━━↑ 接收命令-结束[{}] ↑━━━━━━━━━━━━━━━━━━━━━━", command.getDeviceNo());
        }
    }
}
